package com.apple.swing;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class Util {

	public void writeSharedPerferences(Context c, String file, String key,
			String value) {
		Editor ed = c.getSharedPreferences(file, Context.MODE_PRIVATE).edit();
		ed.putString(key, value);
		ed.commit();
	}

	public void writeSharedPerferences(SharedPreferences prefs, String key,
			String value) {
		Editor ed = prefs.edit();
		ed.putString(key, value);
		ed.commit();
	}

	public void removeSharedPerferences(SharedPreferences prefs, String key,
			String value) {
		Editor ed = prefs.edit();
		ed.remove(key);
		ed.commit();
	}

	public String getSharedPerferences(SharedPreferences prefs, String key,
			String deafult) {
		String value = prefs.getString(key, deafult);
		return value;
	}

	public String getSharedPerferences(Context c, String file, String key,
			String deafult) {
		String value = c.getSharedPreferences(file, Context.MODE_PRIVATE)
				.getString(key, deafult);
		return value;
	}

}
